package space.xxhui.javatts.dao;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;
import space.xxhui.javatts.entity.TtsRecord;

/**
 * @author HitvzByHui
 * date 2021-04-01
 * desc 当缓存用，不用每次都生成文件，存在时就从结果返回
 */
@Mapper
@Component
public interface TtsRecordDao {

    @Select("select * from tts_record where text_md5=#{textMd5} and language=#{language} limit 1")
    TtsRecord getRecord(@Param("textMd5") String textMd5, @Param("language") String language);

    int insert(TtsRecord record);

    @Delete("delete from tts_record where id=#{id}")
    int delete(@Param("id") Integer id);

}
